package com.sushi.controller;

import com.sushi.service.CommentService;
import com.sushi.response.ResponseBO;
import com.sushi.response.ResponsePageBO;
import com.sushi.response.CommentResp;
import com.sushi.request.CommentReq;
import com.sushi.request.CommentPageReq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.*;

/**
 * 评论 控制器
 * @date 2023-05-02
 * @time 17:13:38
 * @author Administrator
 */
@RestController
@Slf4j
public class CommentController {

	@Autowired
	private CommentService commentService;

    

    /**
     * 新增
     */
    @PostMapping("/comment/add")
    public ResponseBO<CommentResp> add(@RequestBody CommentReq req) {
        return commentService.add(req);
    }

    /**
     * 逻辑删除
     */
    @PostMapping("/comment/remove")
    public ResponseBO<CommentResp> remove(@RequestBody CommentReq req) {
        return commentService.logicRemove(req);
    }

    /**
     * 更新
     */
    @PostMapping("/comment/update")
    public ResponseBO<CommentResp> update(@RequestBody CommentReq req) {
        return commentService.updateByField(req);
    }

    /**
     * 列表
     */
    @PostMapping("/comment/list")
    public ResponsePageBO<CommentResp> list(@RequestBody CommentPageReq req) {
        return commentService.listByCondition(req);
    }

    /**
     * 详情
     */
    @PostMapping("/comment/detail")
    public ResponseBO<CommentResp> detail(@RequestBody CommentReq req) {
        return commentService.detail(req);
    };

}